package com.xiaoyu.lanling.common.config;

import android.text.TextUtils;

import com.xiaoyu.base.AppConfig;
import com.xiaoyu.base.BaseConstants;
import com.xiaoyu.base.utils.SharedPreferencesData;

import in.srain.cube.util.Env;
import in.srain.cube.util.StringUtil;

public class HttpConfig {
    private static final String DEV_MODE_HOST = SharedPreferencesData.basic() == null ? "" : SharedPreferencesData.basic().getString(BaseConstants.SharedPreferencesKey.KEY_DEV_MODE_HOST, "");

    private static String sHost = Env.isDevOrInDevMode() && !TextUtils.isEmpty(DEV_MODE_HOST) ? DEV_MODE_HOST : AppConfig.host();

    public static String getHost() {
        return sHost;
    }

    public static void setHost(String host) {
        sHost = StringUtil.defaultIfEmpty(DEV_MODE_HOST, host);
    }

    public static final String SCHEME = "https";
    public static final String BASE_URL = String.format("%s://%s", SCHEME, sHost);

    private static final String API_PREFIX = "/api";
    private static final String BASE_API_URL = BASE_URL + API_PREFIX;

    public static final String WEEX_SCHEME = "weex";
    public static final String BASE_WEEX_URL = String.format("%s://%s", WEEX_SCHEME, sHost);

    public static final String USER_PROFILE = BASE_API_URL + "/user/profile";
    public static final String USER_GET_VOICE = BASE_API_URL + "/user/get-voice";
    public static final String LANLING_SET_PROFILE = BASE_API_URL + "/lanling/set-profile";
    public static final String USER_SET_PHOTOS = BASE_API_URL + "/user/set-photos";
    public static final String USER_GET_LOCATION = BASE_API_URL + "/user/get-location";
    public static final String USER_UPLOAD_VOICE = BASE_API_URL + "/user/upload-voice";
    public static final String USER_SET_USER_SETTING = BASE_API_URL + "/user/set-user-setting";

    public static final String PAY_PREPARE_PAY = BASE_API_URL + "/pay/prepare-pay";

    public static final String COIN_MY_POINT = BASE_API_URL + "/coin/my-point";
    public static final String COIN_MY_COIN = BASE_API_URL + "/coin/my-coin";
    public static final String COIN_MISSION_LIST = BASE_API_URL + "/lanling/mission-list";

    public static final String LANLING_ONLINE_STATE = BASE_API_URL + "/lanling/online-state";
    public static final String LANLING_CHECK_IN = BASE_API_URL + "/lanling/check-in";
    public static final String LANLING_SUBSCRIBE_USER = BASE_API_URL + "/lanling/subscribe-user/";
    public static final String LANLING_BLACK_USER = BASE_API_URL + "/lanling/black-user";
    public static final String LANLING_HOME_PAGE = BASE_API_URL + "/lanling/home-page";
    public static final String LANLING_PROMOTION_LIST = BASE_API_URL + "/lanling/promotion-list";
    public static final String LANLING_FATE_NEARBY_LIST = BASE_API_URL + "/lanling/nearby-list";
    public static final String LANLING_QUICK_STATEMENTS = BASE_API_URL + "/lanling/quick-statements";
    public static final String LANLING_QUICK_STATEMENT_FREQUENCY = BASE_API_URL + "/lanling/quick-statement-frequency";
    public static final String LANLING_LOGIN = BASE_API_URL + "/lanling/login";
    public static final String LANLING_WECHAT_LOGIN = BASE_API_URL + "/lanling/wechat-login";
    public static final String LANLING_LOGOUT = BASE_API_URL + "/lanling/logout";
    public static final String LANLING_VERIFY_RESULT = BASE_API_URL + "/lanling/verify-result";
    public static final String LANLING_GET_VERIFY_TOKEN = BASE_API_URL + "/lanling/get-verify-token";
    public static final String LANLING_GET_FULL_TOKEN = BASE_API_URL + "/lanling/get-full-token";
    public static final String LANLING_PRODUCT_LIST = BASE_API_URL + "/lanling/product-list";
    public static final String LANLING_PRODUCT_DETAIL = BASE_API_URL + "/lanling/product-detail";
    public static final String LANLING_PRODUCT_CONFIRM = BASE_API_URL + "/lanling/product-confirm";
    public static final String LANLING_USER_PAY_ACCOUNT = BASE_API_URL + "/lanling/user-pay-account";
    public static final String LANLING_VERIFY_CONFIRM = BASE_API_URL + "/lanling/verify-confirm";
    public static final String LANLING_GET_RECHARGE_PRODUCT_LIST = BASE_API_URL + "/lanling/get-recharge-product-list";
    public static final String LANLING_UPLOAD_PUSH_TOKEN = BASE_API_URL + "/lanling/upload-push-token";
    public static final String LANLING_COIN_PRODUCT_LIST_AND_BALANCE = BASE_API_URL + "/lanling/coin-product-list-and-balance";
    public static final String LANLING_FRIEND_LIST = BASE_API_URL + "/lanling/friend-list";
    public static final String LANLING_FANS_LIST = BASE_API_URL + "/lanling/fans-list";
    public static final String LANLING_SUBSCRIBE_LIST = BASE_API_URL + "/lanling/subscribe-list";
    public static final String LANLING_VOICE_TEMPLATE_TEXT = BASE_API_URL + "/lanling/voice-template-text";
    public static final String LANLING_FEEDBACK = BASE_API_URL + "/lanling/feedback";
    public static final String LANLING_REPORT = BASE_API_URL + "/lanling/report";
    public static final String LANLING_GET_GIFT_LIST = BASE_API_URL + "/lanling/get-gift-list";
    public static final String LANLING_GET_RELATIONSHIP = BASE_API_URL + "/lanling/get-relationship";
    public static final String LANLING_PLAY_GIFT_ANIMATION = BASE_API_URL + "/lanling/play-gift-animation";
    public static final String LANLING_GET_NOT_PLAYED_GIFT_ANIMATION = BASE_API_URL + "/lanling/get-not-played-gift-animation";
    public static final String LANLING_ACCOST_RECOMMEND = BASE_API_URL + "/lanling/accost-recommend";
    public static final String LANLING_ACCOST_BATCH = BASE_API_URL + "/lanling/accost-batch";
    public static final String LANLING_RANDOM_NAME = BASE_API_URL + "/lanling/random-name";
    public static final String LANLING_RANDOM_AVATAR = BASE_API_URL + "/lanling/random-avatar";
    public static final String LANLING_CHECK_INVITE_CODE = BASE_API_URL + "/lanling/check-invite-code";

    // Mine
    public static final String LANLING_MY_TAB = BASE_API_URL + "/lanling/my-tab";

    // Vip
    public static final String LANLING_GET_MY_VIP = BASE_API_URL + "/lanling/get-my-vip";
    public static final String LANLING_GET_VIP_PRODUCT_LIST = BASE_API_URL + "/lanling/get-vip-product-list";
    public static final String LANLING_SET_VIP_SETTING = BASE_API_URL + "/lanling/set-user-setting";
    public static final String LANLING_GET_VIP_SETTING = BASE_API_URL + "/lanling/get-user-setting";

    // board
    public static final String LANLING_GET_GODDESS_BOARD_LIST = BASE_API_URL + "/lanling/board";

    // board top3
    public static final String LANLING_GET_BOARD_TOP3 = BASE_API_URL + "/lanling/board-tip";

    // Visitor
    public static final String LANLING_GET_MY_VISITOR = BASE_API_URL + "/lanling/my-visitor";
    public static final String LANLING_GET_MY_FOOT_PRINT = BASE_API_URL + "/lanling/my-footprint";

    // Gift
    public static final String LANLING_GIVE_GIFT = BASE_API_URL + "/lanling/give-gift";

    // Not Common
    public static final String IM_ACCOST = BASE_API_URL + "/im/accost";
    public static final String IM_CHAT_RISK_CHECK = BASE_API_URL + "/im/chat-risk-check";

    // call
    public static final String AV_ESTABLISH_CONNECTION = BASE_API_URL + "/av/establish-connection";
    public static final String AV_HANGUP = BASE_API_URL + "/av/hangup";
    public static final String AV_GET_CALL_PARAM = BASE_API_URL + "/av/get-call-param";
    public static final String AV_GET_TOKEN = BASE_API_URL + "/av/get-token";

    // video call
    public static final String AV_VIDEO_ESTABLISH_CONNECTION = BASE_API_URL + "/av/video/establish-connection";
    public static final String AV_VIDEO_HANGUP = BASE_API_URL + "/av/video/hangup";
    public static final String AV_VIDEO_GET_CALL_PARAM = BASE_API_URL + "/av/video/get-call-param";

    // voice match
    public static final String VOICE_MATCH_APPLY_MATCH = BASE_API_URL + "/lanling/voice-match/apply-match";
    public static final String VOICE_MATCH_EXIT_MATCH = BASE_API_URL + "/lanling/voice-match/exit-match";
    public static final String VOICE_MATCH_ESTABLISH_CONNECTION = BASE_API_URL + "/lanling/voice-match/establish-connection";
    public static final String VOICE_MATCH_HANGUP = BASE_API_URL + "/lanling/voice-match/hangup";
    public static final String VOICE_MATCH_IN_QUEUE = BASE_API_URL + "/lanling/voice-match/in-queue";
    public static final String VOICE_MATCH_CHECK_ENTRY_STATUS = BASE_API_URL + "/lanling/voice-match/check-entry-status";
    public static final String VOICE_MATCH_CURRENT_RANK = BASE_API_URL + "/lanling/voice-match/current-rank";
    public static final String VOICE_MATCH_MATCH_EVALUATE = BASE_API_URL + "/lanling/voice-match/match-evaluate";

    // home
    public static final String HOME_GET_ENTRY_SETTING = BASE_API_URL + "/lanling/home/get-entry-setting";

    // video match
    public static final String VIDEO_MATCH_APPLY_MATCH = BASE_API_URL + "/lanling/video-match/apply-match";
    public static final String VIDEO_MATCH_EXIT_MATCH = BASE_API_URL + "/lanling/video-match/exit-match";
    public static final String VIDEO_MATCH_ESTABLISH_CONNECTION = BASE_API_URL + "/lanling/video-match/establish-connection";
    public static final String VIDEO_MATCH_HANG_UP = BASE_API_URL + "/lanling/video-match/hangup";
    public static final String VIDEO_MATCH_IN_QUEUE = BASE_API_URL + "/lanling/video-match/in-queue";
    public static final String VIDEO_MATCH_CHECK_ENTRY_STATUS = BASE_API_URL + "/lanling/video-match/check-entry-status";
    public static final String VIDEO_MATCH_CURRENT_RANK = BASE_API_URL + "/lanling/video-match/current-rank";
    public static final String VIDEO_MATCH_MATCH_EVALUATE = BASE_API_URL + "/lanling/video-match/match-evaluate";

    // moment
    public static final String FEED_ADD_FEED = BASE_API_URL + "/lanling/feed/add-feed";
    public static final String LANLING_MOMENT_RECOMMEND_LIST = BASE_API_URL + "/lanling/feed/recommend-list";
    public static final String LANLING_MOMENT_SUBSCRIBE_LIST = BASE_API_URL + "/lanling/feed/subscribe-list";
    public static final String LANLING_MOMENT_DELETE_MOMENT = BASE_API_URL + "/lanling/feed/delete-feed";
    public static final String LANLING_MOMENT_DETAIL_MOMENT = BASE_API_URL + "/app/feed/feed-detail";
    public static final String LANLING_MOMENT_LIKE_LIST = BASE_API_URL + "/app/feed/like-list";
    public static final String LANLING_MOMENT_COMMENT_LIST = BASE_API_URL + "/app/feed/comment-list";
    public static final String LANLING_MOMENT_LIST = BASE_API_URL + "/app/feed/user-feed-list";
    public static final String LANLING_MOMENT_LIKE = BASE_API_URL + "/lanling/feed/feed-like";
    public static final String LANLING_MOMENT_ADD_COMMENT = BASE_API_URL + "/lanling/feed/add-comment";
    public static final String LANLING_MOMENT_DELETE_COMMENT = BASE_API_URL + "/lanling/feed/delete-comment";

    // remind
    public static final String LANLING_MOMENT_COMMENT_REMIND_LIST = BASE_API_URL + "/app/feed/feed-comment-notice";
    public static final String LANLING_MOMENT_LIKE_REMIND_LIST = BASE_API_URL + "/app/feed/feed-like-notice";

    // invite
    public static final String LANLING_INVITE_BOARD_LIST = BASE_API_URL + "/lanling/invite-rank-list";
    public static final String LANLING_INVITE_INVITE_LIST = BASE_API_URL + "/lanling/invite-list";
    public static final String LANLING_INVITE_EARN_LIST = BASE_API_URL + "/lanling/invite-earn-list";
    public static final String LANLING_INVITE_TIP = BASE_API_URL + "/lanling/invite-tip";
    public static final String LANLING_INVITE_EARN_INFO = BASE_API_URL + "/lanling/invite-earn-total";
    public static final String LANLING_INVITE_SHARE_INFO = BASE_API_URL + "/lanling/invite-shareinfo";
    public static final String LANLING_INVITE_WITHDRAW_BANNER_LIST = BASE_API_URL + "/lanling/get-draw-list";
    public static final String LANLING_INVITE_OTHER_WITHDRAW_MESSAGE = BASE_API_URL + "/lanling/invite-null-text";

    // charming
    public static final String LANLING_CHARMING_LEVEL_INFO = BASE_API_URL + "/lanling/get-user-charm";

    // generosity
    public static final String LANLING_GENEROSITY_LEVEL_INFO = BASE_API_URL + "/lanling/get-user-generosity";

    // guard
    public static final String LANLING_GUARD_GET_MY_GUARD_LIST = BASE_API_URL + "/lanling/get-my-guard-list";
    public static final String LANLING_GUARD_GET_GUARD_ME = BASE_API_URL + "/lanling/get-guard-me";
    public static final String LANLING_GUARD_GIVE_UP_GUARD = BASE_API_URL + "/lanling/give-up-guard";

    // ontv
    public static final String LANLING_ONTV_LIST = BASE_API_URL + "/lanling/ontv-list";
    public static final String LANLING_ONTV_SETTING = BASE_API_URL + "/lanling/ontv-setting";

    public static String getWeexHttpUrlForPath(String path) {
        return BASE_API_URL + "/" + path;
    }
}

